//
//  ZBPickerConfig.m
//  ZBTechniqueLibrary
//
//  Created by apple on 2018/9/30.
//  Copyright © 2018年 apple. All rights reserved.
//

#import "ZBPickerConfig.h"

@implementation ZBPickerConfig
/**
 默认配置
 */
+ (ZBPickerConfig *)defaultPickerConfig
{
    ZBPickerConfig *config = [[ZBPickerConfig alloc]init];
    return config;
}
- (instancetype)init
{
    if(self = [super init])
    {
        
        self.rowHeight = 40;
        self.headerHeight = 44;
        self.pickerViewHeight = 200;
         //默认配置
        self.cancleColor = [UIColor blackColor];
        self.cancleFont = [UIFont systemFontOfSize:14.0];
        self.cancleTitle = @"取消";
        
        self.ensureFont = self.cancleFont;
        self.ensureColor = self.cancleColor;
        self.ensureTitle = @"确定";
        
        self.titleHidden = NO;
        self.textTitle = @"城市选择";
        self.textFont = self.ensureFont;
        self.textColor = self.ensureColor;
        
        self.headerBackgroundColor = [UIColor whiteColor];
        self.headerBottomLineHidden = NO;
        self.headerLineBackgroundColor = [UIColor lightGrayColor];
        
        self.dateFormat = @"yyyy-MM-dd";
        self.timeFormat = @"HH:mm:ss";
        
        self.minDate = [NSDate date];

        
    }
    return self;
}
@end

@implementation ZBAddressModel
- (instancetype)initWithDict:(NSDictionary *)dict
{
    if(self = [super init]){
        self.name = dict[@"name"];
        self.areaId = dict[@"id"];
        NSArray *dictArray = dict[@"list"];
        NSMutableArray *appArray = [NSMutableArray array];
        for (NSDictionary *dict in dictArray) {
            ZBAddressModel *app = [[ZBAddressModel alloc]initWithDict:dict];
            [appArray addObject:app];
        }
        self.list = appArray;
         
    }
    return self;
}
//提供一个类时,最好提供一个类方法(即静态方法),调用构造方法快速创建类对象
+ (instancetype)modelWithDict:(NSDictionary *)dict{
    return [[self alloc]initWithDict:dict];
}

@end
